Calculus of tensors